<template>
	<view class="withdrawal">
		<view class="title">提现金额</view>
		<view class="inputBox flex-r-s-c">
			<view class="symbol">¥</view>
			<input type="number" v-model="price">
		</view>
		<view class="text">当前余额为：¥ {{balance}}元</view>
		<view class="" v-if="withdrawal_interdict > 0">
			<view class="text" style="font-size: 15px;margin: 4px 20px;">温馨提示:</view>
			<view class="text" style="font-size: 15px;margin: 6px 20px;">本平台提供现金提现功能，提现额度为{{withdrawal_interdict}}元，仅当前金额超过发起提现的金额才可以申请提现，剩余金额可在下次满足前述提现额度时申请提现。（提现一般3-5天内到账，您理解并同意如遇高峰，提现到账时间延长）</view>
		</view>
		
		
		<view class="btn" @tap.stop="withdrawalBtn">提现</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				balance: '',
				price: '',
				withdrawal_interdict:'',
			};
		},
		onLoad(el) {
			this.balance = el.balance
			this.withdrawal_interdict = el.withdrawal_interdict
		},
		methods: {
			withdrawalBtn(){
				let that = this
				if(that.price == '') return that.$utils.toast('请输入提现金额') 
				if(Number(that.price) >= Number(that.withdrawal_interdict)){
					that.$api.balanceWithdrawal({
						price: that.price
					}).then(res => {
						that.$utils.toast('提现成功')
						setTimeout(() => {
							uni.navigateBack()
						},2000)
					})
				}else{
					return that.$utils.toast('低于最低提现额度')
				}
			}
		}
	}
</script>

<style lang="less">
	.withdrawal{
		width: 100vw;
		.title{
			width: 90%;
			margin: 30rpx auto;
			font-size: 28rpx;
			font-weight: 400;
			color: #474747;
		}
		
		.inputBox{
			width: 90%;
			margin: 30rpx auto;
			padding: 30rpx 0rpx;
			border-bottom: 1px solid #EFEFEF;
			.symbol{
				font-size: 80rpx;
				font-weight: 500;
				color: #000;
				margin-right: 20rpx;
			}
			input{
				height: 80rpx;
				font-size: 80rpx;
			}
		}
		
		.text{
			width: 90%;
			margin: 40rpx auto;
			font-size: 28rpx;
			font-weight: 400;
			color: #7F8084;
		}
		
		.btn{
			width: 90%;
			height: 96rpx;
			text-align: center;
			line-height: 96rpx;
			border-radius: 96rpx;
			background-color: #000;
			color: #fff;
			font-size: 28rpx;
			font-weight: 500;
			position: fixed;
			left: 50%;
			bottom: 180rpx;
			transform: translateX(-50%);
		}
		
	}
</style>
